// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CustomImageTests.cs" company="Sitecore">
//   Alexander Doroshenko
// </copyright>
// <summary>
//   Defines the custom image tests class.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Sitecore.SharedSource.ImagePlaceholder
{
  using FluentAssertions;
  using Xunit;

  /// <summary>
  /// Defines the custom image tests class.
  /// </summary>
  public class CustomImageTests
  {
    [Fact]
    public void should_parse_single_digit_dimensions()
    {
      // arrange, act
      var dimensions = CustomImage.GetDimensions("Image - Suggested size: 1x1");

      // assert
      dimensions.Should().Be("1x1");
    }

    [Fact]
    public void should_parse_two_digit_dimensions()
    {
      // arrange, act
      var dimensions = CustomImage.GetDimensions("Image - Suggested size: 22x33");

      // assert
      dimensions.Should().Be("22x33");
    }

    [Fact]
    public void should_parse_any_digit_dimensions()
    {
      // arrange, act
      var dimensions = CustomImage.GetDimensions("Image - Suggested size: 123123123x3434");

      // assert
      dimensions.Should().Be("123123123x3434");
    }

    [Fact]
    public void should_ignore_case()
    {
      // arrange, act
      var dimensions = CustomImage.GetDimensions("Image - Suggested size: 123123123X3434");

      // assert
      dimensions.Should().Be("123123123X3434");
    }

    [Fact]
    public void should_return_empty_string_if_no_match()
    {
      // arrange, act
      var dimensions = CustomImage.GetDimensions("Image - Suggested size: 123123123SMTHN3434");

      // assert
      dimensions.Should().Be(string.Empty);
    }
  }
}